package com.wealth.cart.repository;

import java.util.List;

import iaas.repository.BaseRepository;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.wealth.cart.entity.CartItem;

/**
 * 
 * @author zjw
 */

@Repository
public interface CartItemDao extends BaseRepository<CartItem, Long>, JpaSpecificationExecutor<CartItem> {
	
      public CartItem findCartItemByGoodsIdAndCartId(long goodsId,long cartId);
        
  	
      @Query(value="SELECT * FROM t_cart_item c WHERE  c.merchant_id =?1 AND c.cart_id=?2 AND STATUS!=?3",nativeQuery=true)
      public List<CartItem> findCartItemByCartIdAndMerchantIdAndStatus(long cartId,long merId,Integer status);
      
      @Query(value="SELECT * FROM t_cart_item c WHERE  c.merchant_id =?1 AND c.cart_id=?2 AND STATUS=?3",nativeQuery=true)
      public List<CartItem> getSelectCartItem(long cartId,long merId,Integer status);
      
      public List<CartItem> findCartItemByCartIdAndStatus(long cartId,Integer status);
      
      //删除购物车明细
      public void deleteByIdAndCartId(Long Id,Long cartId);
      
}


